extends Control
class_name ShopItem


signal onSelected(item)
var itemResName
var price


func _ready():
	pass


func init(itemResName, price):
	var imageRes = Global.imageFileDict[itemResName]
	$Icon.texture = ImageTexture.create_from_image(imageRes)
	$Price/Label.text = str(price)
	self.price = price
	self.itemResName = itemResName


func _on_mouse_entered():
	self.color.a = 0.1


func _on_mouse_exited():
	self.color.a = 0


func _on_gui_input(event:InputEvent):
	if event.is_pressed():
		onSelected.emit(self)

	
